-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the --filter
option shorter for PHPUnit
#1548
Conversation
Here's what we can do:
Do you think this will be too much trouble to make it worth it? |
@sebastianbergmann would there be an alternative solution? For example setting |
Just to make sure I understand your motivation correctly: you would like to define a list of tests to run? Then, I think, finally implementing sebastianbergmann/phpunit#3387 would be the way to go. That, however, would be a new feature that would only be available in PHPUnit >= 10. |
That's totally fine: whichever solution is implemented in PHPUnit will be in a newer version and infection will most likely always have a wider range of PHPUnit versions to support. I think @maks-rafalko solutions is a good one as it tries to limit the issue but it's a tiny patch at best. @sanmai is also a viable solution but it feels (IMO) like adding a lot of brittle (it tries to find a compromise) code for something that IMO should just be possible without workarounds. @maks-rafalko @sanmai maybe another patch would be to simply remove |
@sanmai @theofidry I've added your ideas for further implementing here #1545 (comment), and will keep that issue open to try improve this filtering farther. For now will merge this small patch and test it on my daily job project with the upcoming 0.25.0 release |
👍 |
This is just an attempt to make the
--filter
shorter. It doesn't fix #1545 though.Explanation:
Difference between
master
and this PR with built--filter
:We can get rid of all the
App\\Tests\\Functional\\Api\\Document\\
and similar prefixes, leaving justClassTest::test_case_method
notation (orClassTest::test_case_method with data set "#1"
if data provider is used).Why not just
test_case_method1|test_case_method2
? Because the less unique the filter, the more tests will be executed (which is worse from performance POV). If we have 1000 files withtest_case_method1
, then all the 1000 tests will be executed. Prefixingtest_case_method1
withClassTest::
make it hopefully unique.On my real project test, this PR saves 13,000 characters from 50,000 and saves the performance (runs the same amount of tests, not more).